<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1.获取添加跟被添加的元素
        var body = document.querySelector('body');
        var ul = document.createElement('ul');
        var li = document.createElement('li');

        // 在子元素的最后追加元素 appendChildren
        body.appendChild(ul);
        // 在指定子元素前面添加元素 insertBefore
        body.insertBefore(li, body.children[0]);
    </script>
</body>

</html>